Embed API
The Embed API is a JavaScript based API for adding embedded content, an embedded hub, or embedded search into an external web page or application. The API injects the result into the hosting page, instead of the alternative technique via iframe.
The API has a native JavaScript version as well as versions that work in React and Angular.
Embed API Structure
The main technique for programming the with the Embed APIs is to instantiate and use the Pyramid Embed client object. The key objects in the Embed API, including the client, are described here.
Then used the instance of the embed client to either embed content, embed a hub or embed search directly on the page.
Accessing the Embed API package
There are 2 techniques for accessing the API library file:
Direct Reference to Library
Add a script tag to the host page referencing the JavaScript file (with your specifics changed out):
<script src="http://mysite.com/no-shell/pyramid-embed-js.min.js"></script>
Library from NPM
Inside your development project install the API using the following syntax for NPM:
JavaScript
npm i @pyramid-embed/embed-js
Angular
npm i @pyramid-embed/embed-angular
React
npm i @pyramid-embed/embed-react
Embed API Examples
There are code examples and snippets throughout the API documentation. However, more complete examples are available below.
- Click here to see an example of embedding using JavaScript on GitHub.
- Click here for other content embedding examples
- Click here for authentication for embedding examples.